package com.halden.mycache;

import com.halden.mycache.core.Impl.MyCache;
import com.halden.mycache.support.EvictStrategy.impl.LRUStrategy;
import com.halden.mycache.api.CacheFactory;
import com.halden.mycache.core.IMyCache;
import com.halden.mycache.support.listener.impl.SlowLogListener;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @Author: halden
 * @Data:2023/2/3 15:25
 * @Description: 用于进行测试
 */
public class Test {
    public static void main(String[] args) throws InterruptedException {
        IMyCache<String, String> myCache = CacheFactory.<String, String>newInstance()
                .size(5)
                .evictStrategy(new LRUStrategy())
                .rdbSaveFile("kryo.txt")
                .rdbReadFile("kryo.txt")
                .openSlowLog()
                .addSlowListener(new SlowLogListener())
                .build();
        //System.out.println(myCache.map().toString());
        myCache.put("test3", "3");
//        for (String key : myCache.keySet()) {
//            System.out.println(key + ": " + myCache.get(key));
//        }
        myCache.remove("test3");
        myCache.close();
    }
}
